import {getCarIcon} from './Icon'
import {getCarMenu} from './contextMenu'
export const getCarMarker=(map,car)=>{
    var menu= getCarMenu(car);
    var marker = new AMap.Marker({
       
        position: car.position,
        icon: getCarIcon(), // 添加 Icon 实例
        title: '北京',
        zoom:11,
        
     });
     marker.on('rightclick', function(e) {
        menu.open(map, e.lnglat);
    });
    map.add(marker);
    var zoom = Math.floor(Math.random() * 7) + 11
    map.setZoomAndCenter(zoom,  car.position);
     
    // map.panTo(car.position);//平行
    setTimeout(()=>{
        map.setFitView();//适配所有标记点
    },2000)

  

 }